<?php
namespace org\crawlgenie\application\document;
use org\crawlgenie\application\base\Application;
use \CGException;


/**
 * Renderer superclass that contains generic template searching code
 *  @author $Author: jinsonxu@gmail.com $:
 *  $Date: 2014-11-09 22:57:19 +0000 (Sun, 09 Nov 2014) $:
 *  $Id: Renderer.php 6 2014-11-09 22:57:19Z jinsonxu@gmail.com $:
 *  @version $Rev: 6 $:
 *  @package crawlgenie.application.document
 *  @subpackage base
 */
class Renderer implements IRenderable {

    protected $_modelArray;
    protected $_dynamicVarArray;
    private static $validViewTypes = array(\CG_VIEW_HTML, \CG_VIEW_XML, \CG_VIEW_JSON);
    protected $_currentViewType = null;

    
    public static function getValidViewTypes() {
        return self::$validViewTypes;
    }


    public function setModels($modelArray, $dynamicVarArray) {
        $this->_modelArray = $modelArray;
        $this->_dynamicVarArray = $dynamicVarArray;
    }


    public function loadLayoutTemplate() {
        if($this->_currentViewType === null) {
            throw new CGException('Missing view type. Unable to load layout template.');
        }

        /*
         * locate appropriate view template file for current module
         * Philosophy of convention over configuration. Format of file to load will be
         * action.module.tmpl.php
        */
        $modulePath = Application::getModulePath();
        $action = Request::getParam('action');

    }


    public function render() {

    }


    public function getOutput() {
        
    }
}
?>
